import axios from '@/libs/api.request'
import axiosDownload from '@/libs/api.download'
import config from '@/config'
import { Message } from 'iview'

// 下载比较特殊
export const download = (uuid) => {
  return axiosDownload.request({
    url: '/sys/appendix/download?uuid=' + uuid,
    method: 'get'
  })
}

export const downloadAppendix = (id) => {
  return axiosDownload.request({
    url: '/sys/appendix/downloadAppendix?id=' + id,
    method: 'get'
  })
}

export const deleteAppendix = (id) => {
  if (config.preview) {
    Message.error('演示模式禁止删除')
  } else {
    return axios.request({
      url: 'sys/appendix/deleteAppendix',
      method: 'post',
      data: id
    })
  }
}
